package com.zhanglijie.improve.aqs.mix.readwrite;

import java.util.concurrent.locks.Lock;

import com.zhanglijie.theory.readwrite.MyReadWriteLock;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/10/30 0030 0:41
 */
public class DeadLockDemo {
    /**
     * 锁升级就死锁
     * @param args
     */
    public static void main(String[] args) {
        MyReentrantLockReadWrite readWrite = new MyReentrantLockReadWrite();
        Lock readLock = readWrite.readLock();
        Lock writeLock = readWrite.writeLock();

        readLock.lock();
        System.out.println("执行业务");
        writeLock.lock();
        System.out.println("is ok");
    }
}
